from fastapi import APIRouter

from app.database.postgre import SessionDep
from app.models.common import AppIdJSON
from app.models.device_logs import AppDeviceLogListParams
from app.services import accounts, device_logs

router = APIRouter(
    prefix='/api/v1/device_logs',
    tags=['backend', 'device_logs']
)


@router.get('/list')
async def device_logs_list(
        account: accounts.LoggedInAccount,
        query_params: AppDeviceLogListParams,
        session: SessionDep):
    response = await device_logs.get_device_logs_list(account, query_params, session)
    return response


@router.post('/clear')
async def clear_all_device_logs(
        account: accounts.LoggedInAccount,
        json_data: AppIdJSON,
        session: SessionDep):
    response = await device_logs.clear_all_device_logs(account, json_data, session)
    return response
